// components/popup-join-company/popup-join-company.js
Component({
	options: {
		styleIsolation: "shared"
	},
    /**
     * 组件的属性列表
     */
    properties: {
		show: {
			type: Boolean
		}
    },
	observers: {
		'show': function(newval) {
			console.log(1111, newval);
			this.setData({
				showDialog: newval
			})
		}
	},
    /**
     * 组件的初始数据
     */
    data: {
		showDialog: false
    },

    /**
     * 组件的方法列表
     */
    methods: {
		/**
		 * 点击取消
		 */
		onCancelDialog() {
            this.triggerEvent('cancel')
		},
		/**
		 * 点击扫描
		 */
		onScan() {
			wx.scanCode({
				success: (res) =>{
					// res.path = res.path.replace(/%3D/g, '=')
					if (!res.path.includes('%3D')) {
						res.path = res.path.replace(/=/g, '%3D')
						res.path = res.path.replace(/&/g, '%26')
						res.path = res.path.replace(/scene%3D/, 'scene=')
					}
					// wx.showModal({
					// 	content: res.path,
					// 	success: () => {
					wx.reLaunch({
						url: '/' + res.path
					})
					// 	}
					// })
				}
			})
		},
    }
})